package com.mark.mall.admin.platform.controller;

import com.mark.mall.admin.platform.dto.param.LoginParam;
import com.mark.mall.common.resultBean.R;
import com.mark.mall.admin.platform.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * Created by admin on 2021/2/28 13:20
 *
 * @author admin
 */
@Slf4j
@RestController
@RequestMapping("/admin")
@Api(tags = "后台用户登录信息")
@RequiredArgsConstructor
public class LoginController {
    private final UserService userService;

    @ApiOperation("后台登录接口")
    @PostMapping("login")
    public R<Boolean> login(@RequestBody @Valid LoginParam param) {
        return userService.login(param.getUserName(), param.getPassword());
    }
}
